﻿<Window x:Class="HelpDesk.Windows.InkLevelWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:HelpDesk.Commands"
        xmlns:AmmasoConverts="clr-namespace:AmmasoConverts;assembly=AmmasoConverts"
        
        Height="300"
        Width="300">
    <Window.Resources>
        <AmmasoConverts:StringToColorBackground x:Key="StringToColorBackground" />
        <AmmasoConverts:StringToColorForeground x:Key="StringToColorForeground" />
        <AmmasoConverts:TonerToString x:Key="TonerToString" />
        <AmmasoConverts:IntToVisibility x:Key="IntToVisibility" />
    </Window.Resources>
    <Grid>
        <Border Background="Red"
                BorderBrush="Black"
                Width="250"
                Height="250"
                CornerRadius="5"
                Visibility="{Binding Items.Count, Converter={StaticResource IntToVisibility}, ElementName=listBox, Mode=OneWay}">
            <TextBlock Text="Not find any TONER"
                       Foreground="Black"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"
                       FontSize="24"
                       FontWeight="Bold" />
        </Border>
        <StackPanel HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Orientation="Horizontal"
                    Visibility="Hidden">
            <StackPanel>
                <Rectangle Width="20"
                           Name="Yellow"
                           Height="50"
                           Fill="Yellow"
                           Margin="5" />
                <TextBlock Text="{Binding Name, ElementName=Yellow}" />
            </StackPanel>
            <StackPanel>
                <Rectangle Width="20"
                           Name="Magenta"
                           Height="50"
                           Fill="Magenta"
                           Margin="5" />
                <TextBlock Text="{Binding Name, ElementName=Magenta}" />
            </StackPanel>
            <StackPanel>
                <Rectangle Width="20"
                           Name="Blue"
                           Height="50"
                           Fill="Blue"
                           Margin="5" />
                <TextBlock Text="{Binding Name, ElementName=Blue}" />
            </StackPanel>
            <StackPanel>
                <Rectangle Width="20"
                           Name="Black"
                           Height="50"
                           Fill="Black"
                           Margin="5" />
                <TextBlock Text="{Binding Name, ElementName=Black}" />
            </StackPanel>
        </StackPanel>
        <StackPanel Visibility="Hidden">

            <TextBlock Width="62"
                       HorizontalAlignment="Left"
                       Text="Yellow"
                       Padding="5,0,0,0"
                       Background="Yellow"
                       Margin="5">
            </TextBlock>
            <TextBlock Width="25"
                       HorizontalAlignment="Left"
                       Text="Magenta"
                       Padding="5,0,0,0"
                       Background="Magenta"
                       Margin="5" />
            <TextBlock Width="52"
                       HorizontalAlignment="Left"
                       Text="blue"
                       Padding="5,0,0,0"
                       Background="blue"
                       Margin="5"
                       Foreground="White" />
            <TextBlock Width="52"
                       HorizontalAlignment="Left"
                       Text="black"
                       Foreground="White"
                       Padding="5,0,0,0"
                       Background="black"
                       Margin="5" />
        </StackPanel>
        <ListBox x:Name="listBox"
                 ItemsSource="{Binding Printertoners}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Width="{Binding Precent}"
                                   HorizontalAlignment="Left"
                                   Text="{Binding MarkerSuppliesDescription,Converter={StaticResource TonerToString}}"
                                   Name="txtColor"
                                   Padding="5,0,0,0"
                                   Background="{Binding Text, Converter={StaticResource StringToColorBackground}, RelativeSource={RelativeSource Self}}"
                                   Margin="5">
                            <TextBlock.Style>
                                <Style>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding MarkerSuppliesDescription,Converter={StaticResource TonerToString}}"
                                                     Value="Black">
                                            <!-- <DataTrigger Binding="{Binding MarkerSuppliesDescription}"
                                                         Value="Black Toner">-->
                                            <Setter Property="TextBlock.Foreground"
                                                    Value="{Binding Path=MarkerSuppliesDescription, Converter={StaticResource StringToColorForeground}}" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <TextBlock Text="{Binding Precent,StringFormat={}{0}%}"
                                   Width="auto"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.Style>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Items.Count, Converter={StaticResource IntToVisibility}, ElementName=listBox, Mode=OneWay}"
                                     Value="0">
                            <!-- <DataTrigger Binding="{Binding MarkerSuppliesDescription}"
                                                         Value="Black Toner">-->
                            <Setter Property="ListBox.Visibility"
                                    Value="Hidden" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ListBox.Style>
        </ListBox>
    </Grid>
</Window>
<!--IsEnabled="{Binding Text, Converter={StaticResource StringToEnable}, ElementName=txt_Computer}">-->
